<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Xppass Administrator's Control Panel</title>
<LINK href="<?php echo $www_site_url?>/public/yav-style.css" type=text/css rel=stylesheet>
<script src="<?php echo $www_site_url?>/public/js/common.js" type="text/javascript"></script>
<script src="<?php echo $www_site_url?>/public/js/ajax.js" type="text/javascript"></script>
<script src="<?php echo $www_site_url?>/public/js/calendar.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo $www_site_url?>/public/js/swfobject.js"></script>
<script>
function getStore(c_id){
	var url = "<?php echo $www_site_url?>/admin.php?action=corporation&view=ajaxstore&c_id="+c_id;
	
	mini.ajax.get(url, function(r){

		var r = eval('(' + r + ')');   

		if(r.s==200){
			var obj = eval('(' + r.d + ')');   
			var selobj = $('store_container');
			for(var i in obj){
				selobj.options[i]=new Option(obj[i].cs_abbr+' '+obj[i].cs_name, obj[i].cs_id) //add a new option to the end of SELECT
			}
			
		}
		if(r.s==400){
			$('msg').innerHTML = r.m;			
		}
	});
	
	return false;
}
</script>
</head>
<body><div id="append"></div>
<div id="msg" style="color:red;text-align:center"></div>

	<div class="container">
			
			<div id="tabs">
				
				<div id="tabs_mainbox" class="tabs_mainbox" >
					<div class="main" id="tabs_main" >
					
							<form action="<?php echo $www_site_url?>/admin.php" method="GET">
							<input type="hidden" name="action" value="chart">				
							<input type="hidden" name="view" value="overall">					
							<table width="100%" border="0">
								<tr>
									<td><?php echo lang('c_title')?>:</td>
									<td align="left"><select name="c_id" onchange="getStore(this.options[this.selectedIndex].value);">
							<option value="">--</option>
							<?php foreach ($corps as $v){?>
							<option value="<?php echo $v['c_id'];?>"  <?php if($v['c_id']==$con['c_id']) echo 'selected';?> ><?php echo $v['c_initial']." ". $v['c_title'];?></option>
							<?php } ?>
							</select></td>
									<td><?php echo lang('cs_name')?>:</td>
									<td align="left"><select id="store_container" name="cs_id">
							<option value="">--</option>
							<?php if(isset($stores) && is_array($stores)){
								foreach ($stores as $v){?>
}
							<option value="<?php echo $v['cs_id'];?>"  <?php if($v['cs_id']==$con['cs_id']) echo 'selected';?> ><?php echo $v['cs_name'];?></option>
							<?php } 
							}?>
							</select></td>
									
									<td align="left">
									<input type="checkbox" name="group[]" value="service" <?php if(strpos($con['group'],'service')!==false) echo "checked";?>>服务
									<input type="checkbox" name="group[]" value="environment" <?php if(strpos($con['group'],'environment')!==false) echo "checked";?>>环境
									<input type="checkbox" name="group[]" value="product" <?php if(strpos($con['group'],'product')!==false) echo "checked";?>>产品
									
									</td>
									<td rowspan="2"><input type="submit" value="<?php echo lang('submit')?>" class="button" /></td>
								</tr>
								<tr>
									<td align="right"><?php echo lang('a_sdate')?>:</td>
			
									<td colspan="2" align="left"><input type="text" name="a_sdate" onclick="showcalendar();" value="<?php echo $con['sdate']?>" class="textfield" /> <?php echo lang('to')?> <input type="text" name="a_edate" onclick="showcalendar();" value="<?php echo $con['edate']?>" class="textfield" /></td>
									<td align="right"><?php echo lang('question_type')?>:</td>
									<td align="left"><select name="scoretype">
							<option value="summary" <?php if($con['scoretype']=='summary') echo "selected";?>><?php echo lang("summary")?></option>
							<option value="yesorno" <?php if($con['scoretype']=='yesorno') echo "selected";?>><?php echo lang("yesorno")?></option>
							<option value="vote" <?php if($con['scoretype']=='vote') echo "selected";?>><?php echo lang("vote")?></option>
							<option value="time" <?php if($con['scoretype']=='time') echo "selected";?>><?php echo lang("score")?></option>
							</select></td>
								</tr>
							</table>
							</form>
							
				</div>
			</div>

		</div>
		
		
		<div class="mainbox">
<?php if($type=='time'){
	if(is_array($questions)){
		foreach ($questions as $k=> $ques){
			
			?>
		
      <div style="float:right;margin-right:10px;">
      
      <a href="javascript:exportImage(<?php echo $ques['rq_id']?>);"><img src="<?php echo $www_site_url?>/public/images/export_image-icon.gif" border="0" title="export Image"></a>
      <a href="javascript:print(<?php echo $ques['rq_id']?>);"><img src="<?php echo $www_site_url?>/public/images/print_icon.jpg" border="0" title="Print"></a>
      </div>
     
	<div id="flashcontent<?php echo $ques['rq_id']?>">
		<strong>You need to upgrade your Flash Player</strong>
	</div>
	<script type="text/javascript">
		// <![CDATA[		
		var so = new SWFObject("<?php echo $www_site_url?>/public/flash/amcolumn.swf", "amcolumn<?php echo $ques['rq_id']?>", "100%", "400px", "8", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addVariable("path", "<?php echo $www_site_url?>/public/flash/");
		 so.addVariable("chart_id", "amcolumn<?php echo $ques['rq_id']?>");
		so.addVariable("settings_file", encodeURIComponent("<?php echo $www_site_url?>/public/flash/amcolumn_settings2.xml?342"));
		so.addVariable("data_file", encodeURIComponent("<?php echo $www_site_url?>/admin.php?action=chart&view=timedata&c_id=<?php echo $con['c_id'];?>&rq_id=<?php echo $ques['rq_id']?>&sdate=<?php echo $sdate?>&edate=<?php echo $edate?>&selstores=<?php echo join(",",$selstores);?>&group=<?php echo $con['group']?>"));
		so.addVariable("preloader_color", "#ffffff");
		so.addVariable("additional_chart_settings", encodeURIComponent("<settings><labels><label lid='0'><text><![CDATA[<b><?php echo "Q".($k+1).'. '.$ques['rq_question'].$chart_title?></b>]]></text></label></labels></settings>"));
		so.write("flashcontent<?php echo $ques['rq_id']?>");
		// ]]>
	</script>
	<?php
		}
	}
	?>
<?php
}else {?>				
	<div id="flashcontent">
		<strong>You need to upgrade your Flash Player</strong>
	</div>

	<script type="text/javascript">
		// <![CDATA[		
		var so = new SWFObject("<?php echo $www_site_url?>/public/flash/amcolumn.swf", "amcolumn", "100%", "450px", "8", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addVariable("path", "<?php echo $www_site_url?>/public/flash/");
		so.addVariable("settings_file", encodeURIComponent("<?php echo $www_site_url?>/public/flash/amcolumn_settings.xml?102"));
		so.addVariable("data_file", encodeURIComponent("<?php echo $www_site_url?>/admin.php?action=chart&view=overalldata&scoretype=<?php echo $con['scoretype']?>&c_id=<?php echo $con['c_id'];?>&sdate=<?php echo $sdate?>&edate=<?php echo $edate?>&selstores=<?php echo join(",",$selstores);?>&group=<?php echo $con['group']?>"));
		so.addVariable("preloader_color", "#ffffff");
		so.addVariable("additional_chart_settings", encodeURIComponent("<settings><labels><label lid='0'><text><![CDATA[<b><?php echo $chart_title?></b>]]></text></label></labels><guides><max_min>true</max_min><guide><title>Internal Average</title><start_value><?php echo $internal_average;?></start_value><inside>true</inside><text_color>#999999</text_color><behind>true</behind><text_size>14</text_size> <width>1</width><color>#999999</color> </guide></guides></settings>"));

		so.write("flashcontent");
		// ]]>
	</script>
<?php }?>
        </p>
              <p>&nbsp;</p>
          <p>&nbsp;</p>
<script>
function print(id){
  document.getElementById("amcolumn"+id).printAsBitmap();
}
function exportImage(id) {
  document.getElementById("amcolumn"+id).exportImage('/plugins/export.php');  
}

</script>	
	<div style="float:right;margin-right:10px;">
      <a href="javascript:printpage(1);"><img src="<?php echo $www_site_url?>/public/images/print_icon.jpg" border="0" title="Print"></a>
      </div>
<!--startprint1-->
<?php if($type=='time'){?>
          <table width="100%" border="0" cellpadding="0" cellspacing="1" class="missionReport">
                <tr>
                  <td colspan="5" class="title"><?php echo lang("original_figures")?></td>
                </tr>
                 <tr>
                  <td><?php echo lang("an_date")?></td>
                  <td><?php echo lang("assignment")?></td>
                  <?php
                  if(is_array($questions)){
		foreach ($questions as $k=>$ques){
			
			?>
                  <td><?php echo "Q".($k+1)?> <?php echo lang("an_date")?></td>
                 <?php }
                  }?>
                </tr>
                <?php
                if(isset($assignments)){
                	foreach ($assignments as $v){
                		?>
                <tr>
                  <td width="15%"><?php echo $v['day']?></td>
                  <td width="40%"><?php echo $v['a_title']?></td>
                  <?php if(isset($v['times']) && is_array( $v['times'])){
                  	foreach ( $v['times'] as $t){
                  		?>

                  <td width="15%"><?php echo $t?></td>
					<?php
                  	}
                  }
                  	?>
                </tr>
                <?php
                	}
                }
                ?>
               
              </table>
     <?php
}else {?>         
         <table width="100%" border="0" cellpadding="0" cellspacing="1" class="missionReport">
                <tr>
                  <td colspan="5" class="title"><?php echo lang("original_figures")?></td>
                </tr>
                 <tr>
                  <td><?php echo lang("an_date")?></td>
                  <td><?php echo lang("assignment")?></td>
                  <td><?php echo lang("service")?></td>
                  <td><?php echo lang("environment")?></td>
                  <td><?php echo lang("product")?></td>
                </tr>
                <?php
                if(isset($assignments)){
                	foreach ($assignments as $v){
                		?>
                <tr>
                  <td width="15%"><?php echo $v['day']?></td>
                  <td width="40%"><?php echo $v['a_title']?></td>
                  <td width="15%"><?php echo $v['service']?></td>
                  <td width="15%"><?php echo $v['environment']?></td>
                  <td width="15%"><?php echo $v['product']?></td>

                </tr>
                <?php
                	}
                }
                ?>
               
              </table>     
        <?php
               }
                
                ?>  
<!--endprint1-->    
		</div>

	</div>

</body>
</html>